﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CCoC3DGeneratorEnabler
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using EngineeringInternalExtension;
using System.Collections.ObjectModel;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands;

public class CCoC3DGeneratorEnabler : ITxCommandEnabler
{
  public bool IsReadyToEnable()
  {
    bool enable = false;
    if (TxApplication.ActiveDocument.PlatformGlobalServicesProvider.IsDataLoaded())
    {
      TxObjectList engineeringRepresentations = ((TxObjectList<ITxObject>) TxApplication.ActiveSelection.GetAllItems()).EngineeringRepresentations;
      if (((Collection<ITxObject>) engineeringRepresentations).Count == 1)
      {
        switch (((Collection<ITxObject>) engineeringRepresentations)[0])
        {
          case ITxTcOperation _:
          case TxTcProcess _:
          case ITxCompoundOperation _:
            enable = true;
            break;
        }
      }
      if (enable)
        enable = TxEngineeringDataInternal.GlobalGetPartsMode() != 2;
    }
    return enable;
  }

  public bool Enable => this.IsReadyToEnable();
}
